#%%
import cv2
import matplotlib.pyplot as plt
import numpy as np

input_img={}

input_img['rgb'] = cv2.imread('Resource\cat.png')
# 截取ROI区域
input_img['roi'] = input_img['rgb'][0:50,0:200]
# 展示ROI区域
# cv2.imshow('roi',input_img['roi'])

# 截取颜色通道
b,g,r = cv2.split(input_img['rgb'])
# 将RGB更新到字典中
input_img.update({
    'r':r,
    'g':g,
    'b':b
})
# 展示BGR画面
# cv2.imshow('b',input_img['b'])
# cv2.imshow('g',input_img['g'])
# cv2.imshow('r',input_img['r'])

# 将BGR合并
input_img['merge']= cv2.merge((input_img['b'],input_img['g'],input_img['r']))

print(input_img['merge'])
cv2.imshow('merge',input_img['merge'])


cv2.waitKey(0)
cv2.destroyAllWindows()